#include <iostream>
#include <cstring>
#include <algorithm>
#include <set>
#include <iomanip>
#include <vector>
#include <cstdio>
#include <cmath>
#define LL long long
#define nextLine() {int c = 0; while ((c = getchar()) != EOF && c != 10);}
#define sqr(a) ((a) * (a))
#define fill(a, c) memset(a, c, sizeof a)
#define ldb long double
const ldb eps = 1e-14;
const ldb pi = fabs(atan2(0.0, -1.0));
const int INF = 1 << 28;
const LL LINF = 1ll << 50;
const ldb LDINF = 1e70;
using namespace std;

int x[2010], y[2010];
int n;

int Load()
{
	cin >> n;
	if (n == 0) return 0;
	int i;
	for (i = 0; i < n; i++)
	{
		scanf("%d%d", &x[i], &y[i]);
	}
	for (i = 0; i < n; i++)
	{
		int t = rand() % n;
		if (t < i)
		{
			swap(x[i], x[t]);
			swap(y[i], y[t]);
		}
	}
	return 1;
}

void cnt(ldb p, ldb q, ldb &dx, ldb &dy)
{
	dx = dy = 0;
	for (int i = 0; i < n; i++)
	{
		if (fabsl(sqrt(sqr(p - x[i]) + sqr(q - y[i]))) > eps)
		{
			dx += (p - x[i]) / sqrt(sqr(p - x[i]) + sqr(q - y[i]));
			dy += (q - y[i]) / sqrt(sqr(p - x[i]) + sqr(q - y[i]));
		}
	}
}

ldb checkPoint(ldb p, ldb q)
{
    ldb dx, dy, d = 0.0;
    int i;
    ldb t = 1e15;
    ldb dx1, dy1;
    for (int s = 0; s < 100; s++)
	{
		cnt(p, q, dx, dy);
		if (fabsl(sqr(dx) + sqr(dy)) < eps) break;
		d = sqrt(sqr(dx) + sqr(dy));
		p -= dx;
		q -= dy;
	}
    for (int s = 0; s < 100; s++)
	{
		cnt(p, q, dx, dy);
		if (fabsl(sqr(dx) + sqr(dy)) < eps) break;
		d = sqrt(sqr(dx) + sqr(dy));
		p -= dx * t / d;
		q -= dy * t / d;
		if (s % 2) t /= 2;
	}
	for (int s = 0; s < 100; s++)
	{
		cnt(p, q, dx, dy);
		if (fabsl(sqr(dx) + sqr(dy)) < eps) break;
		d = sqrt(sqr(dx) + sqr(dy));
		p -= dx / n;
		q -= dy / n;
	}
	int xx = (int)(p + eps);
	int yy = (int)(q + eps);
	ldb res = 1e42, cur;
	for (int k = -3; k <= 3; k++)
	{
		xx += k;
		for (int l = -3; l <= 3; l++)
		{
			yy += l;
			cur = 0;
			for (i = 0; i < n; i++)
			{
				cur += sqrt(sqr((ldb)xx - x[i]) + sqr((ldb)yy - y[i]));
			}
			res = min(res, cur);
			yy -= l;
		}
		xx -= k;
	}
	return res;
}

void Solve()
{
//	cerr << "ok\n";
	ldb p = 0, q = 0;
	int i;
	for (i = 0; i < n; i++)
	{
		p += x[i] / (ldb)n;
		q += y[i] / (ldb)n;
	}
	ldb res = checkPoint(p, q);
/*	for (i = 0; i < n; i++)
	{
		res = min(res, checkPoint(x[i], y[i]));
	}
	*/
	cout << res << "\n";
}

#define file "cpoint"
int main()
{
	#ifndef ONLINE_JUDGE
	freopen(file".in", "rt", stdin);
	freopen(file ".out", "wt", stdout);
	#endif
	cout << setprecision(6) << fixed;
	while (Load()) Solve();
	return 0;
}

// 36214030000.420858